package com.example.restaurant.controller;

import cn.hutool.core.bean.BeanUtil;
import com.example.restaurant.common.Result;
import com.example.restaurant.controller.form.AddDishForm;
import com.example.restaurant.controller.form.AddOrderOperateForm;
import com.example.restaurant.controller.form.ModifyDishOperateForm;
import com.example.restaurant.service.DishOperateService;
import com.example.restaurant.service.param.AddDishParam;
import com.example.restaurant.service.param.AddOrderOperateParam;
import com.example.restaurant.service.param.ModifyDishOperateParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 加退菜表 前端控制器
 * </p>
 *
 * @author x
 * @since 2022-09-29
 */
@RestController
public class DishOperateController {
    @Resource
    private DishOperateService dishOperateService;
    @PostMapping("addDishOperate")
//    public Result addDish(@Valid @RequestBody List<AddDishForm> form){
//        dishOperateService.AddDish(form);
    public Result addDish(@RequestBody AddOrderOperateForm form) {
        AddOrderOperateParam param = BeanUtil.copyProperties(form, AddOrderOperateParam.class);
        dishOperateService.AddDish(param);
        return Result.success();
//    }
    }
}
